#include <iostream>
#include <unordered_map>
using namespace std;
const int N = 2e5 + 10;

int main()
{
    int n; cin >> n;
    int ans = 0;
    for(int i = 1; i <= n; i ++)
    {
        string s; cin >> s;
        if(s.size() == 5 && s[2] == s[4]) 
        {
            bool flag = true;
            unordered_map<char, int> mp;
            for(int i = 0; i < 4; i++) 
            {
                if(mp.count(s[i])) flag = false;
                mp[s[i]]++;
            }
            if(flag) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}